import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../providers/product_provider.dart';
import 'product_spec_dialog.dart';

class ProductSpec extends StatefulWidget {
  const ProductSpec({Key? key}) : super(key: key);

  @override
  _ProductSpecState createState() => _ProductSpecState();
}

class _ProductSpecState extends State<ProductSpec> {
  @override
  Widget build(BuildContext context) {
    return ListTile(
      title: Flex(
        direction: Axis.horizontal,
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          const Text('已选择'),
          Text(
            context.watch<ProductProvider>().sku,
            overflow: TextOverflow.ellipsis,
          )
        ],
      ),
      trailing: const Icon(Icons.arrow_forward_ios, size: 16),
      onTap: () {
        getProductSpecDialog(context);
      }
    );
  }
}